# -*- coding: UTF-8 -*-
# @Time : 2022/1/5 0005 14:15
# @Author : lyw
# @Remark :
from mxsoftpy import View

from index import _
from server.common.IOTManager.PowerCabinet.power_cabinet import PowerDeviceSelectServer, PowerDeviceListServer, \
    PowerDeviceRetrieveServer
from utils.public.params_method import check_params


class PowerDeviceSelectView(View):
    def post(self):
        return _("查询成功"), PowerDeviceSelectServer().select(**self.request.POST)


class PowerDeviceListView(View):
    def post(self):
        return _("查询成功"), PowerDeviceListServer().list()


class PowerDeviceRetrieveView(View):

    def post(self):
        check_params(self.request.POST, ["code"])
        return _("查询成功"), PowerDeviceRetrieveServer().list(**self.request.POST)
